module Admin::ProductsHelper
  def show_visible(display)
    if display == true
      'Visible'
    else
      'Oculto'
    end
  end

  def link_to_add_colors(name, f, association, create_fields = false)
    new_object = f.object.class.reflect_on_association(association).klass.new

    fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
      render(association.to_s.singularize + "_fields", :f => builder)
    end

    link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")", :id => "add_#{association}")
  end
end
